package com.ying.tests.AAAmode.strategy2.controller;

import com.alibaba.fastjson.JSONObject;
import com.ying.tests.AAAmode.strategy2.entity.BusinessLineEnum;
import com.ying.tests.AAAmode.strategy2.service.BusinessLineService;
import com.ying.tests.AAAmode.strategy2.service.RobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

@RestController
@RequestMapping(value = "/two/robot")
public class TwoRobotController {

    @Autowired
    private RobotService robotService;

    /**
     * 转接机器人
     */
    @PostMapping(value = "/turnRobot")
    public void turnRobot() {
        for (BusinessLineEnum value : BusinessLineEnum.values()) {
            BusinessLineService businessLineService = robotService.turnRobot(value);
            if (Objects.isNull(businessLineService)) {
                continue;
            }
            JSONObject messageJson = new JSONObject();
            businessLineService.processBusiness(messageJson);
        }

    }

}
